<!--************************************************************************************************-->
<!-- < mainPage.php >                                                                               -->
<!-- Copyright (c) 2012-2013 San Yat-sun University School of Software                              -->
<!-- Founder & Modifier: Xiaoxin Mo                                                                 -->
<!-- Stu : 10389159                                                                                 -->
<!--                                                                                                -->
<!-- Version : 3.0                                                                                  -->
<!-- LastUpdate : 2013-01-05 14:30 BY Xiaoxin Mo                                                      -->
<!--************************************************************************************************-->

<?php 
	include_once("../db/Friend.php");
	
	class FriendManager{
		static $instance;
		
		public function __construct(){
		}
		
		public function insert($array){
			$friend = new Friend($array);
			$friend->insert();
			return true;
		}
		
		public function delete($array){
			$friend = new Friend($array);
			$friend->delete();
		}
		
		public function update($array){
			$friend = new Friend($array);
			$friend->update();
		}
		
		public static function getInstance(){
			if (self::$instance == null)
				self::$instance = new self();
			return self::$instance;
		}
		
		public function getFriendlistByUsername($username,$N){
			$friend = new Friend(null);
			return $friend->findFriendlistByUsername($username, $N);
		}
		
		public function getFriendnameByUsername($username,$N){
			$friend = new Friend(null);
			return $friend->findFriendnameByUsername($username, $N);
		}
		
		
	}
?>